<include file="Public:header" />

<section class="panel-default">
    <div class="panel-body bg-info">
        <div class="clearfix text-center m-t">
            <div class="inline">
                <div class="thumb-md">
                    <img src="{$userinfo.headimgurl}" onerror="this.src='__PUBLIC__/Index/images/headerIcon.png'"
                         style="border-radius:100px;width:100px;height:100px" class="img-circle" id="img0">
                </div>
                <div class="postbox1">
                    <div class="postboxinput">
                        <div  name="form0" id="form0" >
                            <input class="postimg"  type="file"   onchange="ajaxFileUpload()" name="headimgurl" id="file0" multiple />
                        </div>
                        <div class="outerDiv">更改头像</div>
                    </div>
                </div>
                <div class="h4 m-t m-b-xs">{$userinfo.nickname}</div>
            </div>
        </div>
    </div>
  <!--  <input class="uploads"   type="file"  url="baidu.com"  name="headi"/>-->

    <div class="panel-body">
        <form class="bs-example form-horizontal registerform" method="post" action="{:U('Wap/register')}">
            <div class="form-group">
                <label class="col-lg-2 control-label">公司名称</label>
                <div class="col-lg-10">
                    <input type="text" name="company_name" placeholder="请输入公司名称" class="form-control"/>
                </div>
            </div>
            <div class="line line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">姓名</label>
                <div class="col-lg-10">
                    <input type="text" class="form-control" datatype="/^([\u4e00-\u9fa5]){2,10}$/" name="username"
                           errormsg="请输入2~10个汉字" sucmsg="输入正确！" nullmsg="请输入用户名！" placeholder="请输入姓名" />
                </div>
                <div class="col-lg-10"><span class="Validform_checktip"></span></div>
            </div>
            <div class="line line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">手机号</label>
                <div class="col-lg-10">
                    <input type="tel" class="form-control" datatype="m"
                           errormsg="请输入正确的手机号码"  sucmsg="输入正确！" nullmsg="请输入手机号码！" name="mobile_phone" placeholder="请输入11位手机号码" />
                </div>
                <div class="col-lg-10"><span class="Validform_checktip"></span></div>
            </div>
            <div class="line line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">密码</label>
                <div class="col-lg-10">
                    <input type="password" class="form-control" name="password" placeholder="请输入密码" />
                </div>
                <div class="col-lg-10"><span class="Validform_checktip"></span></div>
            </div>
            <div class="line line-dashed"></div>

            <div class="form-group">
                <label class="col-lg-2 control-label">所属区域</label>
                <div class="col-lg-10">
                    <select name="belong_to_area" class="form-control">
                        <option value="1">成都</option>
                        <option value="2">重庆</option>
                    </select>
                </div>
            </div>
            <div class="line line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">详细地址</label>
                <div class="col-lg-10">
                    <input type="text" placeholder="请输入公司地址" name="company_address" class="form-control">
                </div>
            </div>
            <div class="line line-dashed"></div>


            <div class="form-group panel-body">
                <input type="submit" target-form="form-horizontal" class="btn btn-block btn-info ajax-post" value="确认"/>
            </div>
            <input type="hidden" name="open_id" value="{$userinfo.openid}"/>
            <input type="hidden" name="nickname" value="{$userinfo.nickname}"/>
            <input type="hidden" name="headimgurl" value="{$userinfo.headimgurl}" id="headimgurl"/>
            <input type="hidden" name="sex" value="{$userinfo.sex}"/>
        </form>

    </div>
</section>

<include file="Public:footer" />
<script src="__PUBLIC__/Static/js/ajaxfileupload.js"></script>

<script>

    $(function(){
        $("#index").css('display','none');
    })
        //异步图片上传
        function ajaxFileUpload() {
            $.ajaxFileUpload({
                url: "{:U('Wap/touxiang')}", //用于文件上传的服务器端请求地址
                secureuri: false, //是否需要安全协议，一般设置为false
                fileElementId: 'file0', //文件上传域的ID
                dataType: 'json', //返回值类型 一般设置为json
                async:false,
                success: function (data, status){ //服务器成功响应处理函数
//                        console.log(data);
                    if(data.state=='success'){
                        $("#headimgurl").val(data.info);
                    }else{
                        alert('上传失败');
                    }
                },
                error: function (data, status, e){ //服务器响应失败处理函数
                    alert(e);
                }
            })
            return false;
        }
</script>

